import request from "@/common/http";
import userListResponse from './mock/userList.json'
import {UserListItem} from "@/pages/system/user/constant";

export function apiGetUserList(params: any, useMock?: boolean): Promise<any> {
  if (useMock) {
    return Promise.resolve(userListResponse)
  }
  return request.get('/gateway/ums/sys-user', params)
}

export async function queryUserList(params?: any) {
  return request('/api/sys/user/list', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function querySelectAllData(params?: any) {
  return request('/api/sys/user/selectAllData', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}


export async function removeUser(params: { ids: number[] }) {
  return request('/api/sys/user/delete', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function addUser(params: UserListItem) {
  return request('/api/sys/user/add', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}

export async function updateUser(params: UserListItem) {
  return request('/api/sys/user/update', {
    method: 'POST',
    data: {
      ...params,
    },
  });
}
